import os
from langchain_core.messages import SystemMessage, AIMessage, HumanMessage
from langchain_community.chat_models import ChatZhipuAI

os.environ["ZHIPUAI_API_KEY"] = "d5e990fcbc95675374fa906700efc9d9.w8PDosonZLdIGuTC"
 
class ZhipuAI:
    def __init__(self, temperature:float = 0.5):
        self.llm = ChatZhipuAI(
            model="glm-4",
            temperature=temperature,
            streaming=True
        )
    
    def chat(self, messages):
        response =  self.llm(messages)
        return response.content